package reflection.test;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ResourceBundle;

public class 读取配置文件中的类 {
    public static void main(String[] args) throws Exception {
        ResourceBundle bundle = ResourceBundle.getBundle("p");
        String className = bundle.getString("className");
        String methodName = bundle.getString("methodName");
        System.out.println(className);
        Class clazz = Class.forName(className);
        Constructor constuctor = clazz.getDeclaredConstructor();
        constuctor.setAccessible(true);
        Object o = constuctor.newInstance();
        Method method = clazz.getDeclaredMethod(methodName,String.class,String.class,Integer.class);
        method.setAccessible(true);
        Object result = method.invoke(o, "shibixiu", "female", 23);
        System.out.println(result);

    }
}
